home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_Tix.idb / usr / freeware / lib / tix4.1 / demos / samples / DragDrop.tcl.z / DragDrop.tcl
Encoding:
Text File  |  1999-01-26  |  1.4 KB  |  47 lines

  1. # Tix Demostration Program
  2. #
  3. # This sample program is structured in such a way so that it can be
  4. # executed from the Tix demo program "widget": it must have a
  5. # procedure called "RunSample". It should also have the "if" statment
  6. # at the end of this file so that it can be run as a standalone
  7. # program using tixwish.
  8.  
  9. # This file demonstrates the Drag+Drop features in Tix. Drag+Drop is still
  10. # experimental in Tix. Please don't use. For your eyes only.
  11. #
  12. #
  13. proc RunSample {w} {
  14.  
  15.     text $w.d -height 5
  16.     $w.d insert end {Quick and dirty example:
  17. click on any node on on the directory lists and drag. You can see the
  18. cursor change its shape. The "dropsite" of the directory lists will be
  19. highlighted when you drag the cursor accorss the directory nodes.
  20. Nothing will happen when you drop. }
  21.  
  22.     pack $w.d -padx 10 -pady 5
  23.  
  24.     tixDirList $w.d1; pack $w.d1 -fill both -padx 10 -pady 5 \
  25.     -side left
  26.     tixDirList $w.d2; pack $w.d2 -fill both -padx 10 -pady 5 \
  27.     -side left
  28.  
  29.     button $w.b -text "Close" -command "destroy $w"
  30.     pack $w.b -side left -anchor c -expand yes
  31.  
  32.     $w.d1 subwidget hlist config -selectmode dragdrop
  33.     $w.d2 subwidget hlist config -selectmode dragdrop
  34. }
  35.  
  36. # This "if" statement makes it possible to run this script file inside or
  37. # outside of the main demo program "widget".
  38. #
  39. if {![info exists tix_demo_running]} {
  40.     wm withdraw .
  41.     set w .demo
  42.     toplevel $w
  43.     RunSample $w
  44.     bind $w <Destroy> "exit"
  45. }
  46.  
  47.